package com.dbt.aop.controller;

import com.dbt.aop.aspect.UserAccess;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fangkun
 * @create 2022-08-19-14:41
 *
 *Aspect切面类上可以加上@Order(1)注解，order越小最先执行
 *
 * 切点可以使用切入点表达式指定
 * 也可以自定义注解，给需要使用切面的方法标注注解
 */
@RestController
public class UserController {

    @RequestMapping("/myFirst")
    public Object first(){

        return "first controller";
    }

    @RequestMapping("/myError")
    public Object error(){

        return 10/0;
    }

    @UserAccess(desc = "mySecond")
    @RequestMapping("/mySecond")
    public Object second(){
        return "second controller";
    }
}
